# 分割数组
# https://www.bilibili.com/video/BV19T4y127Z2?p=7&spm_id_from=pageDriver&vd_source=8bd7b24b38e3e12c558d839b352b32f4
import numpy as np

print("numpy split")

x = np.arange(9)
print(x)
print(np.split(x, 3))

# 指定分割的索引
print(np.split(x, [4, 7]))

# 二维数组分割
y = np.array([("Germany", "France", "Hungary", "China"), ("Berlin", "Paris", "Budapest", "Beijing")])
print(y)
# 水平方向分两块
print(np.hsplit(y, 2))
print(np.hsplit(y, 4))
# 垂直分割
print(np.vsplit(y, 2))
